<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <title>帖子</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <!-- CSS
    ================================================== -->
    <link href='http://fonts.googleapis.com/css?family=Oswald' rel='stylesheet' type='text/css'>
    <link rel="stylesheet" href="/static/css/bootstrap.css">
    <link rel="stylesheet" href="/static/css/bootstrap-responsive.css">
    <link rel="stylesheet" href="/static/css/prettyPhoto.css"/>
    <link rel="stylesheet" href="/static/css/custom-styles.css">

    <!--[if lt IE 9]>
    <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
    <link rel="stylesheet" href="/static/css/style-ie.css"/>
    <![endif]-->

    <!-- Favicons
    ================================================== -->
    <link rel="shortcut icon" href="/static/img/favicon.ico">
    <link rel="apple-touch-icon" href="/static/img/apple-touch-icon.png">
    <link rel="apple-touch-icon" sizes="72x72" href="/static/img/apple-touch-icon-72x72.png">
    <link rel="apple-touch-icon" sizes="114x114" href="/static/img/apple-touch-icon-114x114.png">

    <!-- JS
    ================================================== -->
    <script src="http://code.jquery.com/jquery-1.8.3.min.js"></script>
    <script src="/static/js/jquery.easing.1.3.js"></script>
    <script src="/static/js/bootstrap.js"></script>
    <script src="/static/js/jquery.prettyPhoto.js"></script>
    <script src="/static/js/jquery.quicksand.js"></script>
    <script src="/static/js/jquery.custom.js"></script>

</head>

<body>
<div class="color-bar-1"></div>
<div class="color-bar-2 color-bg"></div>

<div class="container">

    <!-- logo，导航栏 -->
    <div class="row header">

        <!-- 左上角图片和logo -->
        <div class="span5 logo" style="width: 250px">
            <h5 style="font-size: 28px">一 个 论 坛</h5>
        </div>

        <!-- 导航栏 -->
        <div class="span7 navigation">
            <div class="navbar hidden-phone"style="height: 40px;">

                <ul class="nav">
                    <li class="active"><a href="/home">主页</a></li>
                    <li><a href="/publish">发帖</a>&nbsp;</li>
                    <li class="dropdown">
                        <a class="dropdown-toggle" data-toggle="dropdown" href="page-full-width.htm">看帖 <b
                                class="caret"></b></a>
                        <ul class="dropdown-menu">
                            <li><a href="/all-0-0-0">全部帖子</a></li>
                            <li><a href="/all-1-0-0">军事</a></li>
                            <li><a href="/all-2-0-0">美食</a></li>
                            <li><a href="/all-3-0-0">汽车</a></li>
                            <li><a href="/all-4-0-0">IT</a></li>
                        </ul>
                    </li>
                    {% if uid %}
                        <li><a>{{ uid }}，欢迎你</a></li>
                        <li><a href="/login">退出</a></li>
                    {% else %}
                        <li><a href="/login">登录</a></li>
                    {% endif %}
                </ul>

            </div>

            <!-- 移动端的导航栏 -->
            <form action="#" id="mobile-nav" class="visible-phone">
                <div class="mobile-nav-select">
                    <select onchange="window.open(this.options[this.selectedIndex].value,'_top')">
                        <option value="">导航栏</option>
                        <option value="index.htm">主页</option>
                        <option value="index.htm">- 全显示</option>
                        <option value="index-gallery.htm">- 只显示帖子列表</option>
                        <option value="index-slider.htm">- 只显示轮播图</option>
                        <option value="features.htm">选项1</option>
                        <option value="page-full-width.htm">页面</option>
                        <option value="page-full-width.htm">- 全显示</option>
                        <option value="page-right-sidebar.htm">- 右边</option>
                        <option value="page-left-sidebar.htm">- 左边</option>
                        <option value="page-double-sidebar.htm">- 双边</option>
                        <option value="page-contact.htm">联系我们</option>
                    </select>
                </div>
            </form>

        </div>

    </div>
    <!-- 3个结束 -->

    <!-- 内容 -->
    <div class="row">

        <!-- 帖子信息 -->
        <div class="span12 gallery-single">

            <div class="row" style="margin-bottom: 0">

                <div class="span6">
                    <!-- 图片 -->
                    <img src="{{ t_photo }}" class="align-left thumbnail" alt="image">
                    <!-- 基本信息 -->
                    <ul class="project-info">
                        <li><h6>发布时间:</h6> {{ t_time }}</li>
                        <li><h6>帖子类别:</h6> {{ t_kind }}</li>
                        <li><h6>作者:</h6> {{ t_uid }}</li>
                    </ul>
                </div>

                <div class="span6">
                    <h2>{{ t_title }}</h2>
                    <p class="lead">{{ t_introduce }}</p>
                    <p>{{ t_content }}</p>
                </div>
            </div>

        </div>

    </div>

    <!-- 留言模块 -->
    <div class="row" style="width: 90%;margin: 0 auto;">
        <h2>我要留言</h2>
        <form action="/single/{{ tid }}/" method="post" enctype="multipart/form-data">
            {% csrf_token %}
            <div style="margin: 0 auto;">
                <textarea style="width: 95%;height: 200px;" cols="62" rows="20" name="r_content"></textarea>
            </div>
            图片：
            <input type="file" name="r_photo">
            <input type="submit" value="提交" style="float: right;">
        </form>
    </div>

    <!-- 评论区 -->
    <div class="row">
        <h2>所有留言</h2>
        <div class="span12 gallery-single">
            <div class="row">
                <div class="span6" style="width: 100%;">
                    <ul class="project-info">
                        {% for r in reply_list %}
                            <li>
                                <h6>{{ r.r_uid }} 说:</h6> {{ r.r_content }}
                                <span style="float: right;">{{ r.r_time }}</span>&nbsp;
{#                                <a style="float: right;margin-right: 10px">回复</a>#}
                                {% if admin_uid %}

                                {% endif %}
                                <a iddd="{{ r.r_id }}" onclick="deleter(this);" style="float: right;margin-right: 10px">删除</a>
                                <img style="width: 50px;height: 50px;" src="{{ r.r_photo }}">
                            </li>
                        {% endfor %}
                    </ul>
                </div>
            </div>
        </div>
    </div>
    <!-- 评论区结束 -->


</div>

<!-- 结尾部分 -->
<div class="footer-container">
    <div class="container">
        <div style="margin-top: 30px" class="row">
            <div class="span12 footer-col footer-sub">
                <div class="row no-margin">
                    <div class="span6"><span class="left">一个论坛</span>
                    </div>
                    <div class="span6">
                            <span class="right">
                            <a href="#">主页</a>&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;<a href="#">选项1</a>&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;<a
                                    href="#">页面</a>&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;<a
                                    href="#">联系我们</a>
                            </span>
                    </div>
                </div>
            </div>
        </div>

    </div>
</div>
<!-- 尾部结束 -->

<!-- 回到顶端 -->
<div id="toTop" class="hidden-phone hidden-tablet">回到顶端</div>


<script>
    function deleter(ths) {
        var rid = $(ths).attr("iddd");
        $.ajax({
            url: window.location.href,
            type: "POST",
            data: {'type': 'delete','r_id': rid},
            beforeSend: function (xhr, settings) {
                xhr.setRequestHeader("X-CSRFToken", "{{ csrf_token }}");    // csrf
            },
            success: function (data) {
                // data是服务器端返回的字符串
                var dic = JSON.parse(data)
                if (!dic.status) alert(JSON.parse(data).msg);
                else window.location.href=window.location.href;
            }
        });
    }
</script>
</body>
</html>
